package org.example.my.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.example.my.model.UserInfo;

@Mapper
public interface UserMapper {
    //根据用户名,查询用户信息
    @Select("select * from user where user_name=#{userName}")
    public UserInfo selectUserInfoByUserName(String userName);

    //根据id,查询用户信息
    @Select("select * from user where id= #{id}")
    public UserInfo selectUserInfoById(Integer id);

    //根据用户名,查询id
    @Select("select id from user where user_name= #{userName}")
    public Integer selectIdByUserName(String userName);

    //注册
    @Insert("insert into user(user_name,password,github_url) values(#{userName},#{password},#{githubUrl})")
    public Integer insertUser(UserInfo userInfo);


}
